package iterator;

import java.util.Iterator;

/**
 * @ClassName FloorIterator
 * @Description TODO
 * @Author leejiliang
 * @DateTime 2021/2/22 14:54
 * @Version 1.0
 */
public class FloorIterator implements Iterator {

	private Floor floor;
	private int index;

	public FloorIterator(Floor floor) {
		this.floor = floor;
		this.index = 0;
	}
	@Override
	public boolean hasNext() {
		if (index < floor.getLength()) {
			return true;
		}
		return false;
	}

	@Override
	public Object next() {
		final Room room = floor.getRoom(index);
		index++;
		return room;

	}
}
